package top.infopub.mgr.fia.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import top.infopub.enums.fia.InvoicePropertyEnum;
import top.infopub.enums.fia.InvoiceTypeEnum;

import java.math.BigDecimal;
import java.util.Date;

public class InvoiceManageDomain {

    /*pk*/
    private String id;
    /*发票号*/
    private String invoiceNo;
    /** 项目编码 */
    private String proCode;
    /*发票归属项目*/
    private String proName;
    /*发票类型（1=增值税普通发票 2=增值税专用发票）*/
    private String invoiceType;
    /*开票日期*/
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date invoiceDate;
    /*开票金额*/
    private BigDecimal invoiceAmount;
    /*开票性质(1=收入发票  2=支出发票)*/
    private String invoiceProperty;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getInvoiceNo() {
        return invoiceNo;
    }

    public void setInvoiceNo(String invoiceNo) {
        this.invoiceNo = invoiceNo;
    }

    public String getProName() {
        return proName;
    }

    public void setProName(String proName) {
        this.proName = proName;
    }

    public String getInvoiceType() {
        return invoiceType;
    }

    public void setInvoiceType(String invoiceType) {
        this.invoiceType = invoiceType;
        if (StringUtils.isNotBlank(invoiceType)) {
            InvoiceTypeEnum ppdt = InvoiceTypeEnum.getByCode(invoiceType);
            if (ppdt != null) {
                setInvoiceType(ppdt.getName());
            }
        }
    }

    public Date getInvoiceDate() {
        return invoiceDate;
    }

    public void setInvoiceDate(Date invoiceDate) {
        this.invoiceDate = invoiceDate;
    }

    public BigDecimal getInvoiceAmount() {
        return invoiceAmount;
    }

    public void setInvoiceAmount(BigDecimal invoiceAmount) {
        this.invoiceAmount = invoiceAmount;
    }

    public String getInvoiceProperty() {
        return invoiceProperty;
    }

    public void setInvoiceProperty(String invoiceProperty) {
        this.invoiceProperty = invoiceProperty;
        if (StringUtils.isNotBlank(invoiceProperty)) {
            InvoicePropertyEnum ppdt = InvoicePropertyEnum.getByCode(invoiceProperty);
            if (ppdt != null) {
                setInvoiceProperty(ppdt.getName());
            }
        }
    }

    public String getProCode() {
        return proCode;
    }

    public void setProCode(String proCode) {
        this.proCode = proCode;
    }
}
